home *** CD-ROM | disk | FTP | other *** search
/ SGI Hot Mix 17 / Hot Mix 17.iso / HM17_SGI / research / examples / demo / demosrc / d_gridding.pro < prev    next >
Text File  |  1997-07-08  |  17KB  |  559 lines

  1. ; $Id: d_gridding.pro,v 1.18 1997/04/15 20:25:50 alan Exp $
  2. ;
  3. ;  Copyright (c) 1997, Research Systems, Inc. All rights reserved.
  4. ;       Unauthorized reproduction prohibited.
  5. ;
  6. ;+
  7. ;  FILE:
  8. ;       d_gridding.pro
  9. ;
  10. ;  CALLING SEQUENCE: d_gridding
  11. ;
  12. ;  PURPOSE:
  13. ;       Display the gridding and interpolation routines in IDL.
  14. ;
  15. ;  MAJOR TOPICS: Data analysis and plotting.
  16. ;
  17. ;  CATEGORY:
  18. ;       IDL 5.0
  19. ;
  20. ;  INTERNAL FUNCTIONS and PROCEDURES:
  21. ;       pro gri_generatePlots       - Generate all the plots
  22. ;       pro d_gridding_Event          - Event handler
  23. ;       pro d_griddingCleanup         - Cleanup
  24. ;       pro d_gridding                - Main procedure
  25. ;
  26. ;  EXTERNAL FUNCTIONS, PROCEDURES, and FILES:
  27. ;       pro gettips                - Main procedure
  28. ;       pro widtips                - Create the tip widget.
  29. ;       pro sizetips               - Size the tip widget.
  30. ;       gridding.txt
  31. ;       gridding.tip
  32. ;
  33. ;  REFERENCE: IDL Reference Guide, IDL User's Guide
  34. ;
  35. ;  NAMED STRUCTURES:
  36. ;       none.
  37. ;
  38. ;  COMMON BLOCS:
  39. ;       none.
  40. ;
  41. ;  MODIFICATION HISTORY: Written by DAT,RSI,  January 1997
  42. ;-
  43. ;--------------------------------------------------------------------
  44. ;
  45. ;  Purpose:  Generate all the plots.
  46. ;
  47. pro gri_GeneratePlots, $
  48.     drawXSize, $         ; IN:   x dimension of drawing area
  49.     drawYSize, $         ; IN:   y dimension of drawing area
  50.     pixmapArray          ; IN:   pixmap array for plotting windows.
  51.  
  52.     previousXMargin = !X.MARGIN
  53.     !X.MARGIN=[7,3]
  54.  
  55.     ;  Generate data. This is a biquadratic function with
  56.     ;  added noise.
  57.     ;
  58.     a = FLTARR(6)
  59.     a = [6.9, -0.0012, -0.1247, -0.035, 0.54, -0.016]
  60.     np =21
  61.     x = FLTARR(np)
  62.     y = FLTARR(np)
  63.     z = FLTARR(np)
  64.  
  65.     x = (randomu(seed, np) -0.5) * 20.0
  66.     y = (randomu(seed, np) -0.5) * 20.0
  67.     for i = 0, np-1 do begin
  68.         z[i] = a[0] + a[1]*x[i] + a[2]*x[i]*x[i] + $
  69.             a[3]*x[i]*y[i] + a[4]*y[i] + a[5]*y[i]*y[i] + $
  70.             RANDOMN(seed,1)*2.0
  71.     endfor
  72.  
  73.     ;  Create the X-Y plots showing the points location.
  74.     ;
  75.     WSET, pixmapArray[0]
  76.     PLOT, x, y, PSYM=1, COLOR=3, BACKGROUND=0
  77.     PLOT, x, y, PSYM=1, COLOR=7, /NODATA, $
  78.         /NOERASE, $
  79.         BACKGROUND=0, $
  80.         XTITLE='X', YTITLE='Y', $
  81.         TITLE='Data Point Locations'
  82.  
  83.     ;  Create the X-Y plots with the Delauney triangulation.
  84.     ;
  85.     WSET, pixmapArray[1]
  86.     PLOT, x, y, PSYM=1, COLOR=3, BACKGROUND=0
  87.     TRIANGULATE, x, y, triangles, bValue
  88.     for i = 0, N_ELEMENTS(triangles)/3-1  do begin
  89.         t = [triangles[*,i], triangles[0,i] ]
  90.         PLOTS, x[t], y[t], COLOR=3
  91.     endfor
  92.     PLOT, x, y, PSYM=1, COLOR=7, /NODATA, $
  93.         /NOERASE, $
  94.         XTITLE='X', YTITLE='Y', $
  95.         BACKGROUND=0, $
  96.         TITLE='Delauney Triangulation'
  97.  
  98.     ;  Create the bilinear interpolation of the triangles.
  99.     ;
  100.     WSET, pixmapArray[2]
  101.     xCoordinates = (FINDGEN(51) - 25.0) * 0.4
  102.     yCoordinates = (FINDGEN(51) - 25.0) * 0.4
  103.  
  104.     SURFACE, TRIGRID(x, y, z, triangles, $
  105.         MISSING=-20.0, MIN_VALUE=-20.0), $
  106.         xCoordinates, yCoordinates, $
  107.         COLOR=5, $
  108.         BACKGROUND=0, $
  109.         XMINOR=0, YMINOR=0, ZMINOR=0, $
  110.         XSTYLE=1, YSTYLE=1, ZSTYLE=1, $
  111.         XRANGE=[-10.0,10.0], YRANGE=[-10.0, 10.0], ZRANGE=[-30.0,30.0]
  112.  
  113.     SURFACE, TRIGRID(x, y, z, triangles, $
  114.         MISSING=-20.0, MIN_VALUE=-20.0), $
  115.         xCoordinates, yCoordinates, $
  116.         COLOR=7, $
  117.         BACKGROUND=0, $
  118.         XMINOR=0, YMINOR=0, ZMINOR=0, $
  119.         /NODATA, /NOERASE, $
  120.         XTITLE='X', YTITLE='Y', ZTITLE='Z', $
  121.         XSTYLE=1, YSTYLE=1, ZSTYLE=1, $
  122.         XRANGE=[-10.0,10.0], YRANGE=[-10.0, 10.0], ZRANGE=[-30.0,30.0]
  123.  
  124.     XYOUTS, 0.5, 0.9, 'Bilinear Interpolation', $
  125.         /NORMAL, ALIGNMENT=0.5, COLOR=7
  126.  
  127.  
  128.     ;  Create the quintic interpolation of the triangles.
  129.     ;
  130.     WSET, pixmapArray[3]
  131.  
  132.     SURFACE, TRIGRID(x, y, z, triangles, /QUINTIC, $
  133.         MISSING=-20.0, MIN_VALUE=-20.0), $
  134.         xCoordinates, yCoordinates, $
  135.         COLOR=8, $
  136.         BACKGROUND=0, $
  137.         XMINOR=0, YMINOR=0, ZMINOR=0, $
  138.         XSTYLE=1, YSTYLE=1, ZSTYLE=1, $
  139.         XRANGE=[-10.0,10.0], YRANGE=[-10.0, 10.0], ZRANGE=[-30.0,30.0]
  140.  
  141.     SURFACE, TRIGRID(x, y, z, triangles, /QUINTIC, $
  142.         MISSING=-20.0, MIN_VALUE=-20.0), $
  143.         xCoordinates, yCoordinates, $
  144.         COLOR=7, $
  145.         BACKGROUND=0, $
  146.         XMINOR=0, YMINOR=0, ZMINOR=0, $
  147.         /NODATA, /NOERASE, $
  148.         XTITLE='X', YTITLE='Y', ZTITLE='Z', $
  149.         XSTYLE=1, YSTYLE=1, ZSTYLE=1, $
  150.         XRANGE=[-10.0,10.0], YRANGE=[-10.0, 10.0], ZRANGE=[-30.0,30.0]
  151.    
  152.     XYOUTS, 0.5, 0.9, 'Quintic Interpolation', $
  153.         /NORMAL, ALIGNMENT=0.5, COLOR=7
  154.  
  155.     ;  Create the smooth interpolation of the triangles.
  156.     ;
  157.     WSET, pixmapArray[4]
  158.  
  159.     SURFACE, TRIGRID(x, y, z, triangles, /QUINTIC, $
  160.         MISSING=-20.0, MIN_VALUE=-20.0, EXTRA=bValue), $
  161.         xCoordinates, yCoordinates, $
  162.         COLOR=10, $
  163.         BACKGROUND=0, $
  164.         XMINOR=0, YMINOR=0, ZMINOR=0, $
  165.         XSTYLE=1, YSTYLE=1, ZSTYLE=1, $
  166.         XRANGE=[-10.0,10.0], YRANGE=[-10.0, 10.0], ZRANGE=[-30.0,30.0]
  167.  
  168.     SURFACE, TRIGRID(x, y, z, triangles, /QUINTIC, $
  169.         MISSING=-20.0, MIN_VALUE=-20.0, EXTRA=bValue), $
  170.         xCoordinates, yCoordinates, $
  171.         COLOR=7, $
  172.         BACKGROUND=0, $
  173.         XMINOR=0, YMINOR=0, ZMINOR=0, $
  174.         /NODATA, /NOERASE, $
  175.         XTITLE='X', YTITLE='Y', ZTITLE='Z', $
  176.         XSTYLE=1, YSTYLE=1, ZSTYLE=1, $
  177.         XRANGE=[-10.0,10.0], YRANGE=[-10.0, 10.0], ZRANGE=[-30.0,30.0]
  178.    
  179.     XYOUTS, 0.5, 0.9, 'Smooth Interpolation', $
  180.         /NORMAL, ALIGNMENT=0.5, COLOR=7
  181.  
  182.     ;  Interpolate and grid by the Kriging method (or
  183.     ;  optimal interpolation).
  184.     ;
  185.     WSET, pixmapArray[5]
  186.     xval = FINDGEN(21) -10.0
  187.     yval = FINDGEN(21) -10.0
  188.  
  189.     eModel = [6.0, 0.4]
  190.     krigres = KRIG2D(z, x, y, $
  191.         EXPONENTIAL = eModel, $
  192.         GS=[1.0, 1.0], $
  193.         BOUNDS=[-10.0, -10.0, 10.0, 10.0] )
  194.  
  195.     SURFACE, krigres, $
  196.         xval, yval, $
  197.         COLOR=1, $
  198.         BACKGROUND=0, $
  199.         XSTYLE=1, YSTYLE=1, ZSTYLE=1, $
  200.         XRANGE=[-10,10], YRANGE=[-10, 10], ZRANGE=[-30,30]
  201.  
  202.     SURFACE, krigres, $
  203.         xval, yval, $
  204.         COLOR=7, $
  205.         BACKGROUND=0, $
  206.         /NODATA, /NOERASE, $
  207.         XTITLE='X', YTITLE='Y', ZTITLE='Z', $
  208.         XSTYLE=1, YSTYLE=1, ZSTYLE=1, $
  209.         XRANGE=[-10,10], YRANGE=[-10, 10], ZRANGE=[-30,30]
  210.  
  211.     XYOUTS, 0.5, 0.9, 'Kriging Interpolation', $
  212.         /NORMAL, ALIGNMENT=0.5, COLOR=7
  213.     x =0
  214.     y =0
  215.     z =0
  216.  
  217.     !X.MARGIN = previousXMargin
  218.  
  219. end     ;   of gri_GeneratePlots
  220. ;
  221. ;--------------------------------------------------------------------
  222. ;
  223. pro D_Gridding_Event, $
  224.     sEvent      ; IN: event structure
  225.  
  226.     ;  Quit this application using the close box.
  227.     ;
  228.     if (TAG_NAMES(sEvent, /STRUCTURE_NAME) EQ $
  229.         'WIDGET_KILL_REQUEST') then begin
  230.         WIDGET_CONTROL, sEvent.top, /DESTROY
  231.         RETURN
  232.     endif
  233.  
  234.     WIDGET_CONTROL, sEvent.id, GET_UVALUE=eventUValue
  235.  
  236.     case eventUValue of
  237.  
  238.         ;  Show the appropriate plot.
  239.         ;
  240.         'SELECT' : begin
  241.             WIDGET_CONTROL, sEvent.top, GET_UVALUE=sInfo, /NO_COPY
  242.             WSET, sInfo.rightWindowID
  243.             selection = WIDGET_INFO(sInfo.wSelectDropList, /DROPLIST_SELECT)
  244.             DEVICE, COPY=[0, 0, sInfo.drawXSize, sInfo.drawYSize, $
  245.                 0, 0, sInfo.pixmapArray[selection]]
  246.             WIDGET_CONTROL, sEvent.top, SET_UVALUE=sInfo, /NO_COPY
  247.         end   ;                      of   SELECT
  248.  
  249.         'GENERATE' : begin
  250.             WIDGET_CONTROL, sEvent.top, GET_UVALUE=sInfo, /NO_COPY
  251.             WIDGET_CONTROL, sEvent.top, /HOURGLASS
  252.     
  253.             WIDGET_CONTROL, sInfo.wTopBase, SENSITIVE=0
  254.             ;  Generate the new data set and plots.
  255.             ;
  256.             gri_GeneratePlots, sInfo.drawXSize, $
  257.                 sInfo.drawYSize, sInfo.pixmapArray
  258.  
  259.             ;  Show the default plots.
  260.             ;
  261.             WSET, sInfo.leftWindowID
  262.             DEVICE, COPY=[0, 0, sInfo.drawXSize, $
  263.                 sInfo.drawYSize, 0, 0, sInfo.pixmapArray[2]]
  264.  
  265.             WSET, sInfo.rightWindowID
  266.             selection = WIDGET_INFO(sInfo.wSelectDropList, /DROPLIST_SELECT)
  267.             DEVICE, COPY=[0, 0, sInfo.drawXSize, $
  268.                 sInfo.drawYSize, 0, 0, sInfo.pixmapArray[selection]]
  269.  
  270.             WIDGET_CONTROL, sInfo.wTopBase, SENSITIVE=1
  271.             WIDGET_CONTROL, sEvent.top, SET_UVALUE=sInfo, /NO_COPY
  272.         end    ;       of  GENERATE
  273.  
  274.         'QUIT' : begin
  275.             WIDGET_CONTROL, sEvent.top, /DESTROY
  276.         end
  277.  
  278.         'ABOUT' : begin
  279.             if (Xregistered('XDisplayFile') NE 0) then RETURN
  280.             XDisplayFile, filepath("gridding.txt", $
  281.                     SUBDIR=['examples','demo','demotext']), $
  282.                 DONE_BUTTON='Done', $
  283.                 TITLE="About gridding and interpolation", $
  284.                 GROUP=sEvent.top, WIDTH=55, HEIGHT=14
  285.         end           ;  of ABOUT
  286.  
  287.         ELSE :   ;  do nothing
  288.  
  289.     endcase
  290. end
  291.  
  292. ;--------------------------------------------------------------------
  293. ;
  294. pro D_GriddingCleanup, wTopBase
  295.  
  296.     ;  Get the color table saved in the window's user value
  297.     ;
  298.     WIDGET_CONTROL, wTopBase, GET_UVALUE=sInfo,/No_Copy
  299.  
  300.     ;  Restore the previous color table.
  301.     ;
  302.     TVLCT, sInfo.colorTable
  303.  
  304.     ;  Restore the previous plot font.
  305.     ;
  306.     !P.FONT = sInfo.plotFont
  307.  
  308.     ;  Delete the pixmaps
  309.     ;
  310.     for i = 0, sInfo.nPixmap-1 do begin
  311.         WDELETE, sInfo.pixmapArray[i]
  312.     endfor
  313.  
  314.     ;  Restore the preivous state.
  315.     ;
  316.     !P.CHARSIZE = sInfo.previousCharSize
  317.     !X.MARGIN = sInfo.previousXMar
  318.     !Y.MARGIN = sInfo.previousYMar
  319.  
  320.     ;  Map the group leader base if it exists.
  321.     ;
  322.     if (WIDGET_INFO(sInfo.groupBase, /VALID_ID)) then $
  323.         WIDGET_CONTROL, sInfo.groupBase, /MAP
  324.  
  325. end   ; of MathStatCleanup
  326.  
  327. ;--------------------------------------------------------------------
  328. ;
  329. ;   PURPOSE  : Show the gridding and interpolation routines.
  330. ;              Display the interpolated values.
  331. ;
  332. pro D_Gridding, $
  333.     GROUP=group, $   ; IN: (opt) group identifier
  334.     APPTLB = appTLB    ; OUT: (opt) TLB of this application
  335.  
  336.     previousXMar = !X.margin
  337.     previousYMar = !Y.margin
  338.  
  339.     !X.MARGIN = [8, 3]
  340.     !Y.MARGIN = [4, 4]
  341.     ; Check the validity of the group identifier
  342.     ;
  343.     ngroup = N_ELEMENTS(group)
  344.     if (ngroup NE 0) then begin
  345.         check = WIDGET_INFO(group, /VALID_ID)
  346.         if (check NE 1) then begin
  347.             print,'Error, the group identifier is not valid'
  348.             print, 'Return to the main application'
  349.             RETURN
  350.         endif
  351.         groupBase = group
  352.     endif else groupBase = 0L
  353.  
  354.     ;  Get the current color table. It will be restored when exiting.
  355.     ;
  356.     TVLCT, savedR, savedG, savedB, /GET
  357.     colorTable = [[savedR],[savedG],[savedB]]
  358.  
  359.     ;  Load the color table and the tek colors.
  360.     ;
  361.     LOADCT, 1 , /SILENT
  362.     TEK_COLOR
  363.  
  364.     ;  Save the font
  365.     ;
  366.     plotFont = !P.FONT
  367.  
  368.     ;  Load a new color table
  369.     ;
  370.     LOADCT, 12, /SILENT
  371.     TEK_COLOR
  372.  
  373.     ;  Get the screen size.
  374.     ;
  375.     DEVICE, GET_SCREEN_SIZE = screenSize
  376.  
  377.     ;  Create the starting up message.
  378.     ;
  379.     if (ngroup EQ 0) then begin
  380.         drawbase = startmes()
  381.     endif else begin
  382.         drawbase = startmes(GROUP=group)
  383.     endelse
  384.  
  385.     ;  Here there are 2 display area. Their size (x dimension)
  386.     ;  Set up their dimensions.
  387.     ;
  388.     drawXSize = (0.9 * screenSize[0]) / 2.0
  389.     drawYSize = drawXSize
  390.  
  391.     ;  Get the tips.
  392.     ;
  393.     sText = getTips(filepath('gridding.tip', $
  394.         SUBDIR=['examples','demo', 'demotext']) )
  395.  
  396.     ;  Create the widgets
  397.     ;
  398.     if (N_ELEMENTS(group) EQ 0) then begin
  399.         wTopBase = WIDGET_BASE(TITLE="Gridding", $
  400.             /TLB_KILL_REQUEST_EVENTS, $
  401.             MAP=0, $
  402.             /COLUMN, $
  403.             TLB_FRAME_ATTR = 1, MBAR=barBase)
  404.     endif else begin
  405.         wTopBase = WIDGET_BASE(TITLE="Gridding", $
  406.             /COLUMN, GROUP_LEADER=group, $
  407.             /TLB_KILL_REQUEST_EVENTS, $
  408.             MAP=0, $
  409.             TLB_FRAME_ATTR = 1, MBAR=barBase)
  410.     endelse
  411.  
  412.         ;  Create the menu bar items
  413.         ;
  414.         wFileButton = WIDGET_BUTTON(barBase, VALUE='File')
  415.  
  416.             wQuitButton = WIDGET_BUTTON(wFileButton, VALUE='Quit', $
  417.                 UVALUE='QUIT')
  418.  
  419.         ;  Create the generate data buttons.
  420.         ;
  421.         wDataButton = WIDGET_BUTTON(barBase, VALUE='Data')
  422.  
  423.             wGridButton = WIDGET_BUTTON(wDataButton, $
  424.                 VALUE='Generate New Data', $
  425.                 UVALUE='GENERATE')
  426.  
  427.         wHelpButton = WIDGET_BUTTON(barBase, VALUE='About', /HELP)
  428.  
  429.             wAboutButton = WIDGET_BUTTON(wHelpButton, $
  430.                 VALUE='About Gridding', $
  431.                 UVALUE='ABOUT')
  432.  
  433.         ;  Create the left and right bases. One display in each
  434.         ;  bases
  435.         ;
  436.         wTopRowBase = WIDGET_BASE(wTopBase, COLUMN=2)
  437.  
  438.             wLeftBase = WIDGET_BASE(wTopRowBase, /COLUMN)
  439.  
  440.                 wLeftDraw = WIDGET_DRAW(wLeftBase, XSIZE=drawXSize, $
  441.                     YSIZE=drawYSize, RETAIN=2, UVALUE='RIGHTDRAW')
  442.  
  443.             wRightBase = WIDGET_BASE(wTopRowBase, $
  444.                 /BASE_ALIGN_CENTER, /COLUMN)
  445.  
  446.                 wRightDraw = WIDGET_DRAW(wRightBase, XSIZE=drawXSize, $
  447.                     YSIZE=drawYSize, RETAIN=2, UVALUE='RIGHTDRAW')
  448.  
  449.                 wSelectDropList = WIDGET_DROPLIST(wRightBase, $
  450.                     VALUE=['Data Point Locations', $
  451.                     'Delauney Triangulation', $
  452.                     'Bilinear Interpolation', $
  453.                     'Quintic Interpolation', $
  454.                     'Smooth Interpolation', $
  455.                     'Kriging Interpolation'], $
  456.                     UVALUE='SELECT')
  457.  
  458.  
  459.         ;  Create tips texts.
  460.         ;
  461.         wStatusBase = WIDGET_BASE(wTopBase, MAP=0, /ROW)
  462.  
  463.             nWidgets = 2
  464.             wText = LONARR(nWidgets)
  465.             widTips, wStatusBase, sText.text, XSIZE=36, $
  466.                 YSIZE=3, NWIDGETS=nWidgets, wText
  467.  
  468.     ;  Realize the widget hierarchy.
  469.     ;
  470.     WIDGET_CONTROL, wTopBase, /REALIZE
  471.  
  472.     ;  Size the tips widgets.
  473.     ;
  474.     sizeTips, wTopBase, wText, wStatusBase
  475.  
  476.     ;  Returns the top level base in the appTLB keyword.
  477.     ;
  478.     appTLB = wTopBase
  479.  
  480.     WIDGET_CONTROL, wSelectDroplist, SET_DROPLIST_SELECT=4
  481.  
  482.     ; Determine the window value of plot window, wLeftDraw and wRightDraw.
  483.     ;
  484.     WIDGET_CONTROL, wLeftDraw, GET_VALUE=leftWindowID
  485.     WIDGET_CONTROL, wRightDraw, GET_VALUE=rightWindowID
  486.  
  487.     ;  Create the pixmaps
  488.     ;
  489.     nPixmap = 6
  490.     pixmapArray = LONARR(nPixmap)
  491.     for i = 0, nPixmap-1 do begin
  492.         WINDOW, /FREE, XSIZE=drawXSize, YSIZE=drawYSize, /PIXMAP
  493.         pixmapArray[i] = !D.Window
  494.     endfor
  495.  
  496.  
  497.     ;  Generate the data and make the triangulation and
  498.     ;  bilinear interpolation as default.
  499.     ;
  500.     gri_GeneratePlots, drawXSize, drawYSize, pixmapArray
  501.  
  502.     ;  Show the default views. On the left view, show 
  503.     ;  bilinear interpolation plot, on the right, show
  504.     ;  the smooth interpolation plot.
  505.     ;
  506.     WSET, leftWindowID
  507.     DEVICE, COPY=[0, 0, drawXSize, drawYSize, 0, 0, pixmapArray[2]]
  508.  
  509.     WSET, rightWindowID
  510.     DEVICE, COPY=[0, 0, drawXSize, drawYSize, 0, 0, pixmapArray[4]]
  511.  
  512.     ;  Get the character scaling factor.
  513.     ;
  514.     charscale = 8.0/!d.X_CH_SIZE
  515.  
  516.     previousCharSize = !P.CHARSIZE
  517.  
  518.     ;  Create the info structure
  519.     ;
  520.     sInfo = { $
  521.         NPixmap: nPixmap, $                    ; Number of pixmaps
  522.         PixmapArray: pixmapArray, $            ; Array of pixmap IDs
  523.         DrawXSize: drawXSize, $                ; X size of drawing area
  524.         DrawYSize: drawYSize, $                ; Y size of drawing area
  525.         ColorTable:colorTable, $               ; color table to restore
  526.         CharScale: charScale, $                ; Character scaling factor
  527.         LeftWindowID: leftWindowID, $          ; Windows ID
  528.         RightWindowID: rightWindowID, $
  529.         WTopBase: wTopBase, $                  ; top level base ID
  530.         WLeftDraw: wLeftDraw, $                ; Widget draw IDs
  531.         WRightDraw: wRightDraw, $
  532.         WSelectDropList: wSelectDropList, $    ; Selection droplist ID
  533.         PreviousCharSize: previousCharSize, $  ; Previous character size
  534.         PreviousXMar: previousXMar, $          ; Previous x margin
  535.         PreviousYMar: previousYMar, $          ; Previous y margin
  536.         plotFont: plotFont, $                  ; Font number
  537.         groupBase: groupBase $                 ; Base of Group Leader
  538.     }
  539.  
  540.     ;  Register the info structure in the user value of the top-level base
  541.     ;
  542.     WIDGET_CONTROL, wTopBase, SET_UVALUE=sInfo, /NO_COPY
  543.  
  544.     ;  Destroy the starting up window.
  545.     ;
  546.     WIDGET_CONTROL, drawbase, /DESTROY
  547.  
  548.     ;  Map the top level base.
  549.     ;
  550.     WIDGET_CONTROL, wTopBase, MAP=1
  551.  
  552.     ; Register with the BIG GUY, XMANAGER
  553.     ;
  554.     XMANAGER, "D_Gridding", wTopBase, $
  555.         /NO_BLOCK, $
  556.         EVENT_HANDLER="D_Gridding_Event", CLEANUP="D_GriddingCleanup"
  557.  
  558. end   ; of gridding
  559.